app.controller('bpmHistoryProcessController', ['$scope', 'httpWrapService', 'dialogs', '$state', '$stateParams','AppConstants','TableFactory',
        function($scope, httpWrapService, dialogs, $state, $stateParams,AppConstants, TableFactory) {

	$scope.params = {};
	var processInstanceId = $scope.params.processInstanceId = {
			field : 'processInstanceId',
			type : AppConstants.filter.CONTAINS,
			term : ''
	};
	
    $scope.Table1 = TableFactory.newInstance({
		url : 'bpm/history/process/finished/list.do',
		params : [processInstanceId]
	});
    $scope.Table1.load();

    $scope.delete = function(target) {
        var id = target.$parent.row.entity.id;
        httpWrapService.defaultDelete('bpm/history/process/finished/delete/'+ id +'.do', {
        }, "确认删除历史流程实例？").then(function(){
            $scope.Grid.deleteRow(target.$parent.row.entity);
        });
    };
}]);

/**
 */
app.filter('bpmManagerProcessDefinitionFilter', ["$sessionStorage", "httpWrapService","customObjectFilterFactory", function($sessionStorage, httpWrapService, customObjectFilterFactory) {
    return function(input, filed){
        return customObjectFilterFactory.newInstance({
            param : {},
            getUrl : function(intput, filed){
                return 'bpm/processinstance/view/' +input+ '.do';
            },
            getKey : function(intput, filed){
                return 'bpmManagerProcessDefinitionFilter_' + input;
            }
        }).filter(input, filed);
    };
}]);
